package com.kll.tv.utils;

import android.content.Context;
import android.text.TextUtils;

import com.kll.tv.MyApplication;

public class AppToast extends android.widget.Toast {

    private static android.widget.Toast toast;

    private AppToast(Context context) {
        super(context);
    }

    public static void show(String msg, int duration) {
        if(msg == null  || TextUtils.isEmpty(msg)){
            return;
        }
        if (toast == null) {
            toast = AppToast.makeText(MyApplication.Companion.getInstance().getBaseContext(), msg, duration);
        } else {
            toast.setText(msg);
        }
        toast.setDuration(duration);
        toast.show();
    }
}
